perm filename LINED.LAP[NEW,LSP] blob sn#309291 filedate 1980-08-21 generic text, type C, neo UTF8
COMMENT ⊗   VALID 00004 PAGES
C REC  PAGE   DESCRIPTION
C00001 00001
C00002 00002	'(THIS IS THE LAP FOR (LINED LSP DSK (ARC DCO)))
C00005 00003	(LAP INITED SUBR)   
C00008 00004	(ENTRY LOADED SUBR)                     PUT STRING INTO LINE EDITOR BUFFER,
C00011 ENDMK
C⊗;
'(THIS IS THE LAP FOR (LINED LSP DSK (ARC DCO)))
'(COMPILED BY LISP COMPILER /703)
;COMPILED ON JUNE 3, 1977, AT 7:57 PM

;HACKED BY HAND

;These functions can load the SAIL line editor with the printed
;representations for lisp forms. Subsequent READs will return
;the line.

;(INITED) sets up a byte pointer in location BPTR to point at the first
;byte in the block at location EDBUFF. It also sets up location COUNT to
;contain -132 decimal.

;(ADDED F FLAG) "prints" the form F into EDBUFF, putting the first
;character into the byte pointed at by BPTR and leaving BPTR pointing at
;the byte after the last byte printed into. If FLAG is true then special
;characters are slashified, otherwise they are not. ADDED also increments
;COUNT everytime it deposits a byte, so that if the buffer ever overflows,
;an error break is done.

;(LOADED) puts a CR into EDBUFF at the place pointed to by BPTR, i.e.  at
;the end of the current string. Then it calls the UUO which loads the line
;editor with the characters in EDBUFF and returns NIL.  BPTR is not
;incremented after depositing the CR so that a subsequent call to ADDED
;will overwrite the CR, making the whole buffer available to be sent to the
;line editor (the UUO PTLOAD stops at activation characters).

;(LOADCR) loads the line editor buffer as does (LOADED) but after finishing
;loading, it activates the contents of the buffer by mimicing a 'type ahead'
;carriage return. 
(LAP INITED SUBR)   
(ARGS INITED (NIL . 0)) 

(MOVE TT (% (+ 350700000000 EDBUFF)))	;MAKE BPTR POINT AT THE FIRST
(MOVEM TT BPTR)				;7-BIT BYTE IN BLOCK AT EDBUFF
(MOVEI TT 132.)	
(MOVNM TT COUNT)			;INIIALIZE COUNT TO -132
(MOVEI A 0)				;RETURN NIL
(051←33 11 0)				;clrbfi (think about this - rpg)
(POPJ P)

(ENTRY ADDED SUBR)
(ARGS ADDED (NIL . 2))

(MOVEM P SAVEP)
(MOVEM FXP SAVEFXP)			;SAVE STACKS (DON'T NEED ALL OF THEM)
(MOVEM SP SAVESP)
(MOVEM FLP SAVEFLP)

(MOVEI R EDFUN)				;PRINTA TAKES IN R THE ADDRESS OF A
					;ROUTINE TO WHICH IT PASSES CHARACTERS
(JUMPE B (+ * 2))			;IF THE SIGN BIT IN R IS SET,
(HRLI R -1)				;PRINTA WILL SLASHIFY
(PUSHJ P PRINTA)
(MOVEI A 'T)				;RETURN T
(POPJ P)

EDFUN					;PRINTA WILL CALL EDFUN WITH
(AOSL 0 COUNT)				;THE CHAR IN REG A. INCREMENT
(JRST 0 ERR)				;COUNT AND GIVE ERROR IF ≥ 0.
(DPB A BPTR)				;ELSE DEPOSIT CHAR
(IBP 0 BPTR)				;AND INCREMENT POINTER
(POPJ P)				;THIS IS PURELY AN INTERNAL ROUTINE,
					;SO ITS OK TO RETURN GARBAGE.
ERR
(MOVE P SAVEP)     			;RESTORE STACKS IN CASE OF ERROR
(MOVE FXP SAVEFXP)			;RETURN NIL
(MOVE FLP SAVEFLP)
(MOVE SP SAVESP)
(MOVEI 2 '|Line overflow in ADDED|)
(MOVEI 1 'T)
(JCALL 2 '*BREAK)			
SAVEP (0)
SAVEFLP (0)
SAVESP (0)
SAVEFXP (0)

(ENTRY LOADED SUBR)                     ;PUT STRING INTO LINE EDITOR BUFFER,
(ARGS LOADED (NIL . 0))                 ; BUT DON'T ACTIVATE IT.
(MOVEI TT 15)				;PUT CR AT END OF STRING
(DPB TT BPTR)

(711←33 15 ARGS)         		;CALL PTLOAD WITH ARGS

(MOVEI 1 'NIL) 				;RETURN NIL
(POPJ P) 




(ENTRY LOADCR SUBR)                     ;SAME AS LOADED EXCEPT ACTIVATE <CR>
(ARGS LOADCR (NIL . 0))
(MOVEI TT 15)				;PUT CR AT END OF STRING
(DPB TT BPTR)

(711←33 17 ARGS)         		;CALL PTL7W9 WITH ARGS

(MOVEI 1 'NIL) 				;RETURN NIL
(POPJ P) 

  ;DATA

COUNT	(0)

BPTR	(0)

;NEXT TWO WORDS ARE THOSE ADDRESSED BY PTLOAD UUO
;ADDITIONAL THIRD WORD IS USED BY PTL7W9.
;THE FIRST SPECIFIES THE USER'S SCREEN AS THE TARGET LINE EDITOR
;THE SECOND IS A POINTER AT THE STRING TO LOAD IT WITH.
;THE THIRD CONSISTS OF TWO NINE-BIT STRINGS: A CARRIAGE RETURN FOLLOWED BY NULL.


ARGS
(0)
(0 0 EDBUFF)
(0 0 CRETURN)

EDBUFF (BLOCK 34)
CRETURN (015000000000)
NIL